package com.itheima.oopadvanced.innerclass_anonymous;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.JavaBean;

/**
 * @author Anomaly
 * @date 2022/12/28 17:23
 */
public class Test3 {
    public static void main(String[] args) {
        JFrame jFrame = new JFrame("登录界面");
        JPanel jPanel = new JPanel();
        jFrame.add(jPanel);

        JButton jButton = new JButton("登录");
        jPanel.add(jButton);


        jFrame.setVisible(true);
        jFrame.setSize(400, 300);
        jFrame.setLocationRelativeTo(null);

        jButton.addActionListener(e -> JOptionPane.showMessageDialog(jFrame, "点我一下"));

//        jButton.addActionListener(new ActionListener() {
//            @Override
//            public void actionPerformed(ActionEvent e) {
//                JOptionPane.showMessageDialog(jFrame, "点我一下");
//            }
//        });
    }
}
